package com.umeox.watch.moto.dataservice.db.dao;


import android.database.Cursor;

import androidx.annotation.NonNull;
import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;

import com.umeox.watch.moto.dataservice.db.model.ServerConfig;

import java.util.List;

@Dao
public interface ServerConfigDao {

    @Query("SELECT * FROM server_config WHERE deviceId=:deviceId")
    ServerConfig query(String deviceId);

    @Query("SELECT * FROM server_config")
    List<ServerConfig> queryAll();

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    long save(@NonNull ServerConfig buddyInfo);

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    void save(List<ServerConfig> items);

    @Delete
    int delete(ServerConfig buddyInfo);

    @Delete
    int delete(List<ServerConfig> items);

    @Query("DELETE FROM server_config")
    int deleteAll();

    @Query("SELECT * FROM server_config")
    Cursor query();
}
